package com.ifox.hgx.spring.annotation.service;

import com.ifox.hgx.spring.annotation.bean.Person;
import com.ifox.hgx.spring.annotation.dao.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.inject.Inject;

@Service
public class PersonService {

//    @Qualifier(value = "personRepository")
    @Autowired(required = false)
//    @Resource
//    @Inject
    private PersonRepository personRepository;

    public Person getPersonById(Integer id) {

        return personRepository.getById(id);
    }

    @Override
    public String toString() {
        return "PersonService{" +
                "personRepository=" + personRepository +
                '}';
    }
}
